package com.gopay.common.cps.dao.autosettle.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;




import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.autosettle.AsBankLimitConfigDAO;
import com.gopay.common.domain.autosettle.AsBankLimitConfig;


/**
 * 
 * @author lizheng
 *
 */
@Repository(value="asBankLimitConfigDAO")
public class AsBankLimitConfigDAOImpl extends BaseDAOImpl<AsBankLimitConfig,Serializable> implements AsBankLimitConfigDAO{

    /**
     * 根据银行代码查询
     * @param bankCode
     * @return
     */
    @Override
    public AsBankLimitConfig findByBankCode(String bankCode){
        DetachedCriteria criteria = DetachedCriteria.forClass(AsBankLimitConfig.class);
        criteria.add(Restrictions.eq("bankCode", bankCode));

        List<AsBankLimitConfig> rsList = this.findByCriteria(criteria);
        return rsList!=null&&rsList.size()>0?rsList.get(0):null;
    }
}
